package behavioral.memento;

/**
 * @Description: 测试类
 * @Author: lxt
 * @CreateDate: 2019/11/1
 **/
public class MementoTest {
    public static void main(String[] args) {
        Document document = new Document("六月第一周例会", "要求小明开发日志模块");

        Caretaker caretaker = new Caretaker();
        caretaker.putMemento("jun-1", document.memento());
        System.out.println("原始文档：");
        System.out.println("\t" + document);

        document.setTitile("六月第二周例会");
        document.setBody("要求小明开发监控页面");

        System.out.println("修改中：");
        System.out.println("\t" + document);

        caretaker.putMemento("jun-2", document.memento());

        System.out.println("撤销中：");

        document.recovery(caretaker.getMemento("jun-1"));

        System.out.println("\t" + document);


    }
}
